package com.topsec.erp.service.impl;

import com.topsec.erp.entity.Performance;
import com.topsec.erp.repository.PerformanceRepository;
import com.topsec.erp.service.PerformanceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * author: zsl
 * date: 2019/11/22 11:13
 * Description:
 */
@Service
public class PerformanceServiceImpl implements PerformanceService {
	// 日志记录器
	private final Logger log = LoggerFactory.getLogger(this.getClass());
	@Autowired
	private PerformanceRepository perrepository;




	@Override
	public List<Performance> queryAll() {
		return perrepository.findAll();
	}

	@Override
	public List<Performance> findByUsername(String username) {
		return perrepository.findByUsernameLike("%"+username+"%");
	}

	@Override
	public Performance findById(long id) {
		return perrepository.getOne(id);
	}

	@Override
	public void save(Performance user) {
		perrepository.save(user);
	}

	@Override
	public void delete(long id) {
		perrepository.deleteById(id);
	}

	@Override
	public void update(Performance user) {
		perrepository.save(user);
	}
}
